<?php
global $options;

foreach ($options as $value) {
    if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
}

$dateformat = get_option('date_format');
$timeformat = get_option('time_format');

$currCat = get_the_category();
$parent = get_cat_name($currCat[0]->category_parent);

//redirect to child if is archive for top-level parent
if ( is_category( $parent ) ) {
	first_subcat_redirect();
}

get_header(); ?>

<div id="content">
    <div class="wrap">
        <div class="column column-narrow">

<?php
echo "<p class='heading'>".$parent."</p>";
//list all categories, posts listed underneath, hide empty
list_cat_posts_all()
?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar: Archive Pages') ) : ?>&nbsp;<?php endif; ?>

        </div><!-- end .column-narrow -->

        <div class="column column-content column-double column-last">
            <div id="crumbs">

<?php
	$staff_slug = $_GET['staff-member'];
	
	$args = array(
		'name' => $staff_slug	   
	);
	
	$individual_query = new WP_Query( $args );
	$title = $individual_query->posts[0]->post_title;
?>

            <!--?php the_breadcrumb(); ?-->
<?php
$args = array(
    'prefix' => '<p>',
    'suffix' => '<span style="font-weight: bold">: ' .$title.'</span></p>',
    'title' => __( '', 'breadcrumbs-plus' ),
    'home' => __( 'Home', 'breadcrumbs-plus' ),
    'sep' => '»',
    'front_page' => false,
    'bold' => true,
    'show_blog' => false,
    'echo' => true,
    'singular_post_taxonomy' => 'category'
);

breadcrumbs_plus( $args );
?>
            </div>
    <?php
		if ( $individual_query->have_posts()) : while ( $individual_query->have_posts()) : $individual_query->the_post();
	?>
    
    <?php
		//set variables
		$job_title = get( 'general_detail_position_title' );
		$email = get( 'contact_detail_email' );
		$room_num = get( 'contact_detail_building_room_number' );
		$office_tel = get( 'contact_detail_office_phone_number' );
		$other_tel = get( 'contact_detail_other_phone_number' );
		$fax_num = get( 'contact_detail_fax_number' );
		$office_hrs = get( 'contact_detail_office_hours' );
		
	?>
    
	  	<h1><?php the_title(); ?></h1>
        <h4><?php echo $job_title; ?></h4>
        
        <?php the_content(); ?>
		<br />
		<dl class="tablelike">
        <?php 
		
			if ( $email ) { echo "<dt>Email</dt><dd><a href='mailto:".$email."'>".$email."</a></dd>"; }
			if ( $office_tel ) { echo "<dt>Office Number</dt><dd>".$office_tel."</dd>"; }
			if ( $other_tel ) { echo "<dt>Other Number</dt><dd>".$other_tel."</dd>"; }
			if ( $fax_num ) { echo "<dt>Fax Number</dt><dd>".$fax_num."</dd>"; }
			if ( $room_num ) { echo "<dt>Room Number</dt><dd>".$room_num."</dd>"; }
		//echo $email.$office_tel.$other_tel.$fax_num.$room_num."<br />";
		
		?>
		</dl>
        
        
        <?php wp_link_pages(array('before' => '<p class="pages"><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
        <?php the_tags( '<p class="tags"><strong>Tags:</strong> ', ', ', '</p>'); ?>
        
        <?php 
		$staff_cat_id = get_cat_ID( 'Staff' );
		$staff_cat_link = get_category_link( $staff_cat_id );
		?>
        <p class="postmetadata"> Updated <span class="datetime"><?php the_time("$dateformat"); ?></span> &nbsp;&nbsp; See all <span class="category"><a href="<?php echo $staff_cat_link; ?>">Staff</a></span></p>
        <?php comments_template(); ?>
      
      </div><!-- end .column-content -->

      <?php if ($layout != 'double' && $layout != 'full') { ?><div class="column column-narrow column-last">
      
        <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar: Posts (Right)') ) : ?>&nbsp;<?php endif; ?>
      
      </div><!-- end .column-narrow -->
      <?php } ?>
	  <?php	endwhile; endif; ?>

    <div class="clear">&nbsp;</div>

    </div><!-- end .wrap -->

</div><!-- end #content -->

<?php get_footer(); ?>